package com.wish.blessingroad.entity;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Data;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * <p>
 * 祝福表
 * </p>
 *
 * @author dhc
 * @since 2019-02-18
 */
@Data
@Accessors(chain = true)
@TableName("blessing")
public class Blessing extends Model<Blessing> {

    private static final long serialVersionUID = 1L;
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 用户名称
     */
    @NotBlank(message = "姓名不能为空")
    @Length(max = 60, message = "姓名长度超出限制")
    private String name;

    /**
     * 性别：男；女
     */
    @NotBlank(message = "性别不能为空")
    private String sex;

    /**
     * 祝福语
     */
    @NotBlank(message = "祝福语不能为空")
    @Length(max = 360, message = "祝福语长度超出限制")
    private String content;

    /**
     * 地址选择
     * 不用数据库，直接赋值
     */
    private String address;

    /**
     * 执行日期
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime excuteDate;
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(exist = false)
    private LocalDateTime excuteDateS;
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(exist = false)
    private LocalDateTime excuteDateE;

    /**
     * 用户id
     */
    private Integer userId;

    /**
     * 添加日期
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createDate = LocalDateTime.now();

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(exist = false)
    private LocalDateTime createDateS;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(exist = false)
    private LocalDateTime createDateE;
    /**
     * 更新日期
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateDate;

    /**
     * 结束日期
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime endDate;

    /**
     * 类型：1:祝福；2:许愿
     */
    @NotNull(message = "类型不能为空")
    private Integer type;

    /**
     * 状态：0:无效 1:有效；2:过期
     */
    private Integer status = 0;

    /**
     * 祝福值 分为单位
     */
    private int fuValue = 0;

    /**
     * 菩萨id 0:全部 1：文殊
     */
    private Integer pusaName;

   /* @JsonSerialize(using = CustomDateSerializer.class)
    public Date create_time;
    @TableField(exist = false)
    public String tableName;*/

    /**
     * 指定主键
     */
    @Override
    protected Serializable pkVal() {
        return this.id;
    }


    public static final String ID = "id";

    public static final String NAME = "name";

    public static final String SEX = "sex";

    public static final String CONTENT = "content";

    public static final String ADDRESS = "address";

    public static final String EXCUTE_DATE = "excute_date";

    public static final String USER_ID = "user_id";

    public static final String CREATE_DATE = "create_date";

    public static final String UPDATE_DATE = "update_date";

    public static final String END_DATE = "end_date";

    public static final String TYPE = "type";

    public static final String STATUS = "status";

    public static final String FU_VALUE = "fu_value";

    public static final String PUSA_NAME = "pusa_name";

}
